# _*_coding:utf-8_*_
from ATS.instrumentDriver import InstCom as inst

matrix = "MTRX1"


def MATRIX_CONTROL(matrix, is_openall, connection_list):
    """
    matrix: "MTRX1"
    is_openall: 0/1
    connection_list: ["r0_c0","r1_c1"]
    """
    # matrix = "MTRX1"
    mtrx = inst.getinstobj(matrix)
    if mtrx:
        if is_openall:
            mtrx.DisconnectAll()
        # do connection
        mtrx.ConnectMultiple(connection_list)
        mtrx.WaitForCompletion()
